package com.szdvte.news.bean;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


public class News {
	private Integer newsId;
	private String newsTitle;
	private String newsContent;
	private String newsAddress;
	private String newsSource;
	private Date newsData;
	private Integer newsFlag;
	private Integer newsStatus;
	private Integer commentsCount;//跟帖数量
	private Integer startIndex = 1;
	private Integer endIndex = 21;
	private Integer rownum;
	private String newsParserData;
	private String newsTypeName;
    private List<NewsFilmResource> photos = new ArrayList<NewsFilmResource>();
    private List<Comments> comments = new ArrayList<Comments>();
    public News() {
	}
	public News(Integer newsId, String newsTitle, String newsContent,
			String newsAddress, String newsSource, Date newsData,
			Integer newsFlag, Integer commentsCount, Integer startIndex,
			Integer endIndex, Integer rownum, List<NewsFilmResource> photos,
			List<Comments> comments) {
		super();
		this.newsId = newsId;
		this.newsTitle = newsTitle;
		this.newsContent = newsContent;
		this.newsAddress = newsAddress;
		this.newsSource = newsSource;
		this.newsData = newsData;
		this.newsFlag = newsFlag;
		this.commentsCount = commentsCount;
		this.startIndex = startIndex;
		this.endIndex = endIndex;
		this.rownum = rownum;
		this.photos = photos;
		this.comments = comments;
	}
	@Override
	public String toString() {
		return "News [newsId=" + newsId + ", newsTitle=" + newsTitle
				+ ", newsContent=" + newsContent + ", newsAddress="
				+ newsAddress + ", newsSource=" + newsSource + ", newsData="
				+ newsData + ", newsFlag=" + newsFlag + ", commentsCount="
				+ commentsCount + ", startIndex=" + startIndex + ", endIndex="
				+ endIndex + ", rownum=" + rownum + ", photos=" + photos
				+ ", comments=" + comments + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((comments == null) ? 0 : comments.hashCode());
		result = prime * result
				+ ((commentsCount == null) ? 0 : commentsCount.hashCode());
		result = prime * result
				+ ((endIndex == null) ? 0 : endIndex.hashCode());
		result = prime * result
				+ ((newsAddress == null) ? 0 : newsAddress.hashCode());
		result = prime * result
				+ ((newsContent == null) ? 0 : newsContent.hashCode());
		result = prime * result
				+ ((newsData == null) ? 0 : newsData.hashCode());
		result = prime * result
				+ ((newsFlag == null) ? 0 : newsFlag.hashCode());
		result = prime * result + ((newsId == null) ? 0 : newsId.hashCode());
		result = prime * result
				+ ((newsSource == null) ? 0 : newsSource.hashCode());
		result = prime * result
				+ ((newsTitle == null) ? 0 : newsTitle.hashCode());
		result = prime * result + ((photos == null) ? 0 : photos.hashCode());
		result = prime * result + ((rownum == null) ? 0 : rownum.hashCode());
		result = prime * result
				+ ((startIndex == null) ? 0 : startIndex.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		News other = (News) obj;
		if (comments == null) {
			if (other.comments != null)
				return false;
		} else if (!comments.equals(other.comments))
			return false;
		if (commentsCount == null) {
			if (other.commentsCount != null)
				return false;
		} else if (!commentsCount.equals(other.commentsCount))
			return false;
		if (endIndex == null) {
			if (other.endIndex != null)
				return false;
		} else if (!endIndex.equals(other.endIndex))
			return false;
		if (newsAddress == null) {
			if (other.newsAddress != null)
				return false;
		} else if (!newsAddress.equals(other.newsAddress))
			return false;
		if (newsContent == null) {
			if (other.newsContent != null)
				return false;
		} else if (!newsContent.equals(other.newsContent))
			return false;
		if (newsData == null) {
			if (other.newsData != null)
				return false;
		} else if (!newsData.equals(other.newsData))
			return false;
		if (newsFlag == null) {
			if (other.newsFlag != null)
				return false;
		} else if (!newsFlag.equals(other.newsFlag))
			return false;
		if (newsId == null) {
			if (other.newsId != null)
				return false;
		} else if (!newsId.equals(other.newsId))
			return false;
		if (newsSource == null) {
			if (other.newsSource != null)
				return false;
		} else if (!newsSource.equals(other.newsSource))
			return false;
		if (newsTitle == null) {
			if (other.newsTitle != null)
				return false;
		} else if (!newsTitle.equals(other.newsTitle))
			return false;
		if (photos == null) {
			if (other.photos != null)
				return false;
		} else if (!photos.equals(other.photos))
			return false;
		if (rownum == null) {
			if (other.rownum != null)
				return false;
		} else if (!rownum.equals(other.rownum))
			return false;
		if (startIndex == null) {
			if (other.startIndex != null)
				return false;
		} else if (!startIndex.equals(other.startIndex))
			return false;
		return true;
	}
	public List<Comments> getComments() {
		return comments;
	}
	public void setComments(List<Comments> comments) {
		this.comments = comments;
	}
	public Integer getNewsId() {
		return newsId;
	}
	public void setNewsId(Integer newsId) {
		this.newsId = newsId;
	}
	public String getNewsTitle() {
		return newsTitle;
	}
	public void setNewsTitle(String newsTitle) {
		this.newsTitle = newsTitle;
	}
	public String getNewsContent() {
		return newsContent;
	}
	public void setNewsContent(String newsContent) {
		this.newsContent = newsContent;
	}
	public String getNewsAddress() {
		return newsAddress;
	}
	public void setNewsAddress(String newsAddress) {
		this.newsAddress = newsAddress;
	}
	public String getNewsSource() {
		return newsSource;
	}
	public void setNewsSource(String newsSource) {
		this.newsSource = newsSource;
	}
	public Date getNewsData() {
		return newsData;
	}
	public void setNewsData(Date newsData) {
		this.newsData = newsData;
	}
	public Integer getNewsFlag() {
		return newsFlag;
	}
	public void setNewsFlag(Integer newsFlag) {
		this.newsFlag = newsFlag;
	}
	public Integer getCommentsCount() {
		return commentsCount;
	}
	public void setCommentsCount(Integer commentsCount) {
		this.commentsCount = commentsCount;
	}
	public Integer getStartIndex() {
		return startIndex;
	}
	public void setStartIndex(Integer startIndex) {
		if(startIndex==null || startIndex==0){
			this.startIndex = 1;
		}else{
			this.startIndex = startIndex;
		}
		
	}
	public Integer getEndIndex() {
		return endIndex;
	}
	public void setEndIndex(Integer endIndex) {
		if(endIndex==null || endIndex==0){
			this.endIndex = 21;
		}else{
			this.endIndex = endIndex;
		}
	}
	public Integer getRownum() {
		return rownum;
	}
	public void setRownum(Integer rownum) {
		this.rownum = rownum;
	}
	public List<NewsFilmResource> getPhotos() {
		return photos;
	}
	public void setPhotos(List<NewsFilmResource> photos) {
		this.photos = photos;
	}
	public String getNewsParserData() {
		return newsParserData;
	}
	public void setNewsParserData(String newsParserData) {
		this.newsParserData = newsParserData;
	}
	public Integer getNewsStatus() {
		return newsStatus;
	}
	public void setNewsStatus(Integer newsStatus) {
		this.newsStatus = newsStatus;
	}
	public String getNewsTypeName() {
		return newsTypeName;
	}
	public void setNewsTypeName(String newsTypeName) {
		this.newsTypeName = newsTypeName;
	}
 
	
}
 